package uaiContacts.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Droog
 */
@Entity
@Table(name = "tb_categoria", catalog = "sistema_ipi", schema = "public")
public class Categoria implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_categoria", nullable = false)
    private Integer idCategoria;
    @Basic(optional = false)
    @Column(name = "dsc_categoria", nullable = false, length = 100)
    private String dscCategoria;
    @Basic(optional = false)
    @Column(name = "ind_tipo", nullable = false)
    @Basic(optional = false)
    @Column(name = "ind_ativo", nullable = false)
    private Character indAtivo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCategoria")
    private List<LancamentoFincanc> lancamentoFincancList;

    public Categoria() {
    }

    public Categoria(Integer idCategoria) {
        this.idCategoria = idCategoria;
    }

    public Categoria(Integer idCategoria, String dscCategoria, Character indTipo, Character indAtivo) {
        this.idCategoria = idCategoria;
        this.dscCategoria = dscCategoria;
        this.indTipo = indTipo;
        this.indAtivo = indAtivo;
    }

    public Integer getIdCategoria() {
        return idCategoria;
    }

    public void setIdCategoria(Integer idCategoria) {
        this.idCategoria = idCategoria;
    }

    public String getDscCategoria() {
        return dscCategoria;
    }

    public void setDscCategoria(String dscCategoria) {
        this.dscCategoria = dscCategoria;
    }

    public Character getIndTipo() {
        return indTipo;
    }

    public void setIndTipo(Character indTipo) {
        this.indTipo = indTipo;
    }

    public Character getIndAtivo() {
        return indAtivo;
    }

    public void setIndAtivo(Character indAtivo) {
        this.indAtivo = indAtivo;
    }

    @XmlTransient
    public List<LancamentoFincanc> getLancamentoFincancList() {
        return lancamentoFincancList;
    }

    public void setLancamentoFincancList(List<LancamentoFincanc> lancamentoFincancList) {
        this.lancamentoFincancList = lancamentoFincancList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoria != null ? idCategoria.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Categoria)) {
            return false;
        }
        Categoria other = (Categoria) object;
        if ((this.idCategoria == null && other.idCategoria != null) || (this.idCategoria != null && !this.idCategoria.equals(other.idCategoria))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Categoria[ idCategoria=" + idCategoria + " ]";
    }
    
}
